using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace FrameWork.TileMapManager
{
    public class CropManager : SingletonMonoBehaviour<CropManager>
    {
        [SerializeField] private CropModel[] cropDatas;
        public Dictionary<string, CropModel> GetCropDic { get; private set; }

        protected override void Awake()
        {
            base.Awake();
            // 初始化
            GetCropDic = new Dictionary<string, CropModel>();

            // 添加数据
            for (int i = 0; i < cropDatas.Length; i++)
            {
                GetCropDic.Add(cropDatas[i].cropName, cropDatas[i]);
            }
        }


        /// <summary>
        /// 生成成熟作物
        /// </summary>
        /// <param name="cropType"></param>
        public void SpawnCrop(string cropName)
        {
            ObjectPool.Instance.Spawn(cropName);
        }
    }
}
